import cv2
import numpy as np

x = np.empty([0, 4], dtype=int)

faceCascade = cv2.CascadeClassifier("haarcascade_frontalface_default.xml")
img1 = cv2.imread(r'D:\projects\dataset\11.jpg')
# img1 = cv2.imread('D:\projects\Pythonproject4\surprise.jpg')
imgGray1 = cv2.cvtColor(img1, cv2.COLOR_BGR2GRAY)
face1 = faceCascade.detectMultiScale(imgGray1, scaleFactor=1.3, minNeighbors=5, minSize=(30, 30))
x = np.append(x, [[1, 2, 3, 4]], axis=0)  # 添加整行元素，axis=1添加整列元素

for (x, y, w, h) in face1:
    # cv2.rectangle(img1, (x, y), (x+w, y+h), (255, 0, 0), 2)
    # print(x, y, w, h)
    # x = np.append(x, [[1, 2, 3, 4]], axis=0)  # 添加整行元素，axis=1添加整列元素
    print(x)

    print(type(x))



cv2.imshow("Result1", img1)

cv2.waitKey(0)

